#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "inputdialog.h"
#include "sliderdialog.h"



#include<QMessageBox>


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->actionOpen,SIGNAL(triggered(bool)),this,SLOT(actionOpenSlot()));
    QObject::connect(ui->actionBaidu,SIGNAL(triggered(bool)),this,SLOT(actionBaiduSlot()));
    QObject::connect(ui->actionSlider,SIGNAL(triggered(bool)),this,SLOT(actionSliderSlot()));

}

void MainWindow::receive_data(QString str_tmp)
{
    ui->lineEdit_2->setText(str_tmp);


}
MainWindow::~MainWindow()
{
    delete ui;
}

//void MainWindow::send_data(QString str_tmp)
//{


//}
void MainWindow::on_pushButton_clicked()
{
    InputDialog *inW = new InputDialog;
    QObject::connect(inW,SIGNAL(send_data(QString)),this,SLOT(receive_data(QString)));//从子窗体->父窗体的连接（基于子->父的信号槽）
    inW->display_received_text(ui->lineEdit->text());//从父窗体->子窗体的连接（基于子窗体的public方法）
    inW->exec();
}
void MainWindow::actionOpenSlot()
{

    QMessageBox::information(this, "message", "open");
}
void MainWindow::actionBaiduSlot()
{

    QMessageBox::information(this, "message", "这个功能没做");
}
void MainWindow::actionSliderSlot()
{
    //QMessageBox::information(this, "message", "打开带滑动条的窗口");
    sliderDialog *dlg = new sliderDialog;
    dlg->exec();



}
